package com.authine.cloudpivot.ext.kingdee;

import com.authine.cloudpivot.ext.enums.kingdee.BusinessType;
import lombok.extern.slf4j.Slf4j;

import java.util.HashSet;
import java.util.Set;

/**
 * @Author: liwei
 * @DateTime: 2021/7/6
 * @Description: TODO 凭证
 */
@Slf4j
public class VoucherExecutor {


    public   static Set<String> set1 = new HashSet();
    public   static Set<String> set2 = new HashSet();
    public   static Set<String> set3 = new HashSet();
    static {

        // 平台客户蓝票
        set1.add(BusinessType.PlatformCustomerInvoice.no);
        // 平台供应商蓝票
        set1.add(BusinessType.PlatformSupplierInvoice.no);
        //平台客户红冲发票单
        set1.add(BusinessType.PlatformCustomerRedInvoice.no);
        //平台供应商红冲发票单
        set1.add(BusinessType.PlatformSupplierRedInvoice.no);
        // 收款单
        set1.add(BusinessType.CollectionApplyForm.no);
        // 转采收票单
        set1.add(BusinessType.TransferTicket.no);
        //平台供应商服务费蓝票单
        set1.add(BusinessType.PlatformVendorBlueTicket.no);
        // 平台供应商服务费红票单
        set1.add(BusinessType.PlatformSupplierRedTicket.no);

        // 转采付款单
        set2.add(BusinessType.TransferPaymentSlip.no);

        // 付款申请单
        set3.add(BusinessType.PaymentRequest.no);

    }


    public static int getAttachments(boolean paymentType, BusinessType businessType) {

        if (set1.contains(businessType.no)) {
            return 1;
        }

        if (set2.contains(businessType.no)){
            if (paymentType) {
                return 2;
            }
            return 1;
        }

        if (set3.contains(businessType.no)) {
            return 2;
        }

        return 0;
    }




}
